/* Copyright 2017 The LUCI Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* Generic */

.console-column {
  display: flex;
  flex-direction: column;
}

.console-commits-column {
  justify-content: flex-end;
  flex: 0;
}

.console-row {
  display: flex;
  flex-direction: row;
}

.fill-row {
  width: 100%;
}

/* Title */

.console-title {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
}

.console-title img {
  width: 16px;
  height: 16px;
}

.console-title span {
  font-weight: bold;
  min-height: 2.5em;
}

/* Tree Status */

.tree-status {
  margin-bottom: 6px;
  padding: 0.5em;
  overflow: hidden;
  word-break: break-word;
  font-weight: normal;
  font-size: 16px;
  font-family: Verdana, Cursor;
  text-align: center;
  border-top-right-radius: 24px;
  border-top-left-radius: 24px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.6);
}

/* Header */

.console-header {
  display: flex;
  flex-direction: row;
  border-radius: 0.5em;
  border: 1px solid silver;
  margin-bottom: 2em;
  background-color: rgb(239, 239, 239);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6);
  padding: 0.5em;
}

.console-header-column {
  display: flex;
  flex-direction: column;
}

.console-header-column:last-of-type {
  min-width: 75%;
}

.console-header-groups {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
}

.console-header-oncalls-group {
  display: flex;
  flex-direction: column;
  margin: 0.2em;
  max-width: 45%;
}

.console-header-links-group {
  display: flex;
  flex-direction: column;
  margin: 0.2em;
  max-width: 80%;
}

.console-header-group-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: bold;
  min-height: 1.25em;
}

.console-header-group-content {
  display: flex;
  justify-content: space-evenly;
  flex-wrap: wrap;
  min-height: 1.25em;
}

.console-header-group-content span {
  padding-left: 0.2em;
  padding-right: 0.2em;
}

.console-header-group {
  display: flex;
  flex-direction: column;
  border-radius: 0.5em;
  border: 1px solid silver;
  margin: 0.5em;
  padding: 0.5em;
}

.console-header-group-title {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.33em;
  border-bottom: 1px solid silver;
}

.console-header-group-title a {
  text-decoration: none;
}

.console-header-name {
  display: flex;
  flex-direction: row;
  font-weight: bold;
  padding: 0.5em;
}

.console-header-builder {
  display: flex;
  flex-grow: 1;
  min-height: 2em;
  max-height: 2em;
  min-width: 2em;
  border-width: 1px;
  border-style: solid;
  border-radius: 0.25em;
}

/* Legend */
#legend {
  display: flex;
  justify-content: center;
  margin-bottom: 1em;
  font-weight: bold;
}

/* Controls */

.expanded .control-expand {
  display: none;
}

.collapsed .control-collapse {
  display: none;
}

/* Commits */

.console-controls {
  margin: 1em;
}

.console-commit-column {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.console-commit-column div.console-commit-item:nth-child(even),
.console-commit-column div.console-commit-item:nth-child(even) p {
  background-color: #cccccc;
}

.console-commit-column div.console-commit-item:nth-child(odd),
.console-commit-column div.console-commit-item:nth-child(odd) p {
  background-color: #eee;
}

.console-commit-column div.console-commit-item:nth-child(even).bottom-hidden .console-commit-description-overlay {
  background-image: linear-gradient(rgba(204, 204, 204, 0) 0%, rgba(204, 204, 204, 0.9) 95%);
}

.console-commit-column div.console-commit-item:nth-child(odd).bottom-hidden .console-commit-description-overlay {
  background-image: linear-gradient(rgba(238, 238, 238, 0) 0%, rgba(238, 238, 238, 0.9) 95%);
}

.console-commit-description {
  position: relative;
  overflow: hidden;
}

.console-commit-description:hover {
  overflow: visible;
  z-index: 18;
}

.bottom-hidden .console-commit-description p {
  border-bottom: 1px solid black;
}

.console-commit-description-overlay {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 80px;
}

.console-commit-description:hover .console-commit-description-overlay {
  background-image: none !important;
}

.console-commit-item {
  display: flex;
  align-items: center;
  justify-content: left;
  flex-direction: column;
  position: relative;
}

.collapsed .console-commit-item {
  margin-bottom: 2px;
}

.console-commit-item-overlay {
  position: absolute;
  top: -1px;
  left: 0;
  z-index: 16;
  border-top: 1px solid black;
}

.collapsed .console-commit-item-overlay {
  display: none;
}

.console-commit-summary {
  display: flex;
  flex-direction: row;
  min-width: 2em;
  min-height: 2em;
  margin-right: -0.2em;
  padding: 1px 1em;
}

.expanded .console-commit-item  {
  border-top: 1px solid black;
}

.console-commit-revision {
  width: 6em;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  font-family: monospace;
  font-weight: bold;
}

.console-commit-author {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.collapsed .console-commit-author  {
  width: 15em;
}

.expanded .console-commit-author {
  width: 25em;
}

.commit {
  font-weight: bold;
}

.console-commit-description {
  width: 40em;
  z-index: 12;
  border-top: 1px solid black;
}

.console-commit-description p {
  padding-left: 1em;
  word-break: break-word;
}

.collapsed .console-commit-description {
  display: none;
}

/* Table Header */

.console-top-row {
  display: flex;
  flex-direction: row;
  border-left: 1px solid silver;
  border-right: 1px solid silver;
  margin-left: 0.2em;
  padding-right: 0.2em;
}

.console-top-item {
  display: flex;
  border-top: 1px solid silver;
  border-left: 1px solid silver;
  border-right: 1px solid silver;
  border-bottom: 1px solid transparent;
  min-width: 1em;
  min-height: 2em;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 0.5em;
  border-top-right-radius: 0.5em;
  margin-left: 0.2em;
  padding-left: 0.2em;
  padding-right: 0.2em;
  white-space: nowrap;
}

.no-category .console-top-item {
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: 2px solid transparent;
}

.expanded .console-top-item {
  padding-bottom: 1em;
}

.console-space {
  display: flex;
  border: 1px solid transparent;
  min-width: 1em;
  min-height: 2em;
}

.expanded .console-space {
  min-height: 3em;
}

/* Builders */

.console-builder-summary-flex {
  display: flex;
  flex-grow: 1;
  align-items: center;
  margin: 0.2em;
}

@supports not (display: grid) {
  .console-builder-summary-grid {
    display: flex;
    width: 100%;
  }
}

@supports (display: grid) {
  .console-builder-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(2em, 1fr));
    width: 100%;
  }
}

.console-builder-summary-flex * {
  margin: 0.05em;
}

.console-builder-status {
  display: block;
  height: 100%;
  width: 100%;
  text-decoration: none;
}

.console-builder-column {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.console-builder-column:last-of-type {
  margin-right: -0.2em;
}

.console-Success a.console-builder-item {
  background-color: #8d4;
  border-color: #4F8530;
}

.console-Failure a.console-builder-item {
  background-color: #e88;
  border-color: #A77272;
  color: #000;
  font-weight: bold;
}

.console-InfraFailure a.console-builder-item {
  background-color: #ac39ac;
  border-color: #ACA0B3;
  color: #ffffff;
}

.console-Exception a.console-builder-item {
  background-color: #ac39ac;
  border-color: #ACA0B3;
  color: #ffffff;
}

.console-builder-item {
  display: flex;
  border: 1px solid silver;
  min-width: 1em;
  min-height: 2em;
  text-decoration: none;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border-top-left-radius: 0.5em;
  border-top-right-radius: 0.5em;
  margin-top: 0.75em;
  margin-bottom: 2px;
  margin-right: 1px;
  margin-left: 1px;
  white-space: nowrap;
}

.console-cell-text {
  white-space: nowrap;
}

/* Builds */

.console-build-column, .console-build-column-stacked {
  display: flex;
  flex-grow: 1;
  flex-direction: column;
}

.expanded .console-cell-container-inner {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-start;
}

.console-cell-container a {
  text-decoration: none;
  align-items: center;
  justify-content: center;
}

.console-build-column div.console-cell-container:nth-child(even),
.console-build-column-stacked div.console-cell-container:nth-child(even) {
  background-color: #cccccc;
}

.console-build-column div.console-cell-container:nth-child(odd),
.console-build-column-stacked div.console-cell-container:nth-child(odd){
  background-color: #eee;
}

.collapsed .console-cell-spacer {
  display: none;
}

.collapsed .console-cell-text {
  display: none;
}

/* Table Cells */

.console-cell, .console-cell-top, .console-cell-middle, .console-cell-bottom {
  display: flex;
  min-width: 1em;
  height: 20px;
  border-radius: 0.5em;
  border-width: 1px;
  border-style: solid;
}

.collapsed .console-cell, .collapsed .console-cell-top, .collapsed .console-cell-middle, .collapsed .console-cell-bottom {
  margin-right: 1px;
  margin-left: 1px;
}

.collapsed .console-cell-top, .collapsed .console-cell-middle {
  padding-bottom: 3px;
}

.collapsed .console-cell-top {
  margin-top: 1px;
}

.collapsed .console-cell-top {
  display: flex;
  min-width: 1em;
  min-height: 2em;
  border-bottom-left-radius: unset;
  border-bottom-right-radius: unset;
  border-top-left-radius: 0.5em;
  border-top-right-radius: 0.5em;
  border-width: 1px;
  border-style: solid;
  border-bottom: none;
}

.collapsed .console-cell-middle {
  display: flex;
  min-width: 1em;
  min-height: 2em;
  border-width: 1px;
  border-style: solid;
  border-top: none;
  border-bottom: none;
  border-radius: unset;
  padding-top: 1px;
}

.collapsed .console-cell, .collapsed .console-empty-cell {
  margin-top: 1px;
  margin-bottom: 1px;
}

.collapsed .console-cell-bottom {
  padding-top: 1px;
  margin-bottom: 1px;
}

.collapsed .console-cell-bottom {
  display: flex;
  min-width: 1em;
  min-height: 2em;
  border-bottom-left-radius: 0.5em;
  border-bottom-right-radius: 0.5em;
  border-top-left-radius: unset;
  border-top-right-radius: unset;
  border-width: 1px;
  border-style: solid;
  border-top: none;
  padding-top: 1px;
}

.expanded .console-cell,
.expanded .console-empty-cell,
.expanded .console-cell-middle,
.expanded .console-cell-top,
.expanded .console-cell-bottom {
  flex-grow: 1;
  padding-left: 4px;
  padding-right: 4px;
}

.console-empty-cell {
  display: flex;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 0.5em;
  height: 20px;
  min-width: 1em;
}

.collapsed .console-empty-cell {
  border: 1px solid transparent;
  min-width: 1em;
}

.console-empty-cell:hover {
  cursor: default;
}

/* Console List */

.console-list-builder {
  display: flex;
  flex-grow: 1;
  min-height: 2em;
  max-height: 2em;
  min-width: 0.5em;
  border-width: 1px;
  border-style: solid;
  border-radius: 0.25em;
}
